package com.kornero.auto.util.view;

import org.eclipse.swt.widgets.Composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Proxy;

public class SWTFactory {

    private static final Logger logger = LoggerFactory.getLogger(SWTFactory.class);

    @SuppressWarnings("unchecked")
    public static <T> T createObject(final Composite instance, final Class<T> instanceInterface) {
        return (T) Proxy.newProxyInstance(SWTFactory.class.getClassLoader(), new Class<?>[]{instanceInterface},
                new SWTInvocationHandler(instance));
    }
}
